#!/bin/bash
set -e
export LANG=zh_CN.UTF-8
export JAVA_HOME=/usr
export LOG_BASE=/home/wangbin/workspace/pinyin/log
export WEB_ROOT=/home/wangbin/workspace/pinyin/

mkdir -p ${LOG_BASE}

CLASSPATH=${WEB_ROOT}/WEB-INF/classes
for i in ${WEB_ROOT}/WEB-INF/lib/*
do
CLASSPATH=${CLASSPATH}:${i}
done
export CLASSPATH

source ${WEB_ROOT}/WEB-INF/classes/boot.ini
export JVM_ARGS
export JVM_GC
export JVM_HEAP
export JVM_SIZE

JVM_DUMP="-Xloggc:${LOG_BASE}/app.gc.log -XX:ErrorFile=${LOG_BASE}/app.vmerr.log -XX:HeapDumpPath=${LOG_BASE}/app.heaperr.log"
JETTY_ARGS="-Djetty.webroot=${WEB_ROOT} -Djetty.logs=${LOG_BASE}"
export JVM_DUMP
export JETTY_ARGS

exec ${JAVA_HOME}/bin/java ${JVM_ARGS} ${JVM_GC} ${JVM_HEAP} ${JVM_SIZE} ${JVM_DUMP} ${JETTY_ARGS} com.sankuai.mms.mtefficient.boot.JettyBoot > ${LOG_BASE}/boot.log 2>&1


# java -Dfile.encoding=UTF-8 -classpath ./WEB-INF/classes/;./WEB-INF/lib/ com.wbin.yd.taiwan.JettyBoot